Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Optimal is a system for building and validating any value with typed schemas, and first-class support for defined object structures, like options objects, configuration files, validation fields, and many more. Optimal aims to provide a powerful API, with high performance, the lowest possible filesize, and TypeScript-first support.
// Import schemas to build validators withs
import { array, string, number, optimal } from 'optimal';
// Define and validate values with individual schemas
const maxSizeSchema = number().positive().lte(10000);
maxSizeSchema.validate(1234);
// Or define an explicit shaped blueprint
const schema = optimal({
name: string().notEmpty(),
include: array().of(string()),
exclude: array().of(string()),
maxSize: maxSizeSchema
});
// Pass a full or partial object to validate
const options = schema.validate({ name: 'Optimal' });
// Which validates, builds, and returns the following object
{
name: 'Optimal',
include: [],
exclude: [],
maxSize: 10000,
}
yarn add optimal
FAQs
Build, validate, and transform values with immutable typed schemas.
The npm package optimal receives a total of 32,850 weekly downloads. As such, optimal popularity was classified as popular.
We found that optimal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.